﻿using System;
using System.Collections.Generic;
using System.Text;

namespace curbside.Web.UI.WebControls
{
    public class TextAreaEditer : TextArea
    {
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            helper.AddScriptToHeader("ckeditor", "/client/ckeditor/ckeditor.js", this.Page);
        }

        public override System.Web.UI.WebControls.TextBoxMode TextMode
        {
            get
            {
                return System.Web.UI.WebControls.TextBoxMode.MultiLine;
            }
        }

        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            base.Render(writer);
            string jsEventCode = " $().ready(function(){CKEDITOR.replace('" + this.ClientID + "',{";

            jsEventCode += "skin : 'office2003',";
            jsEventCode += "fullPage : true,";
            jsEventCode += "language : 'zh-cn'";

            jsEventCode += "});});";
            helper.AddStartupScript(this.ClientID, jsEventCode);
        }
    }
}
